def response(
        code: int = 10000,
        status: bool = True,
        msg: str = "成功",
        data=None,
):
    return {
        "code": code,
        "status": status,
        "msg": msg,
        "data": data,
    }


def success(data=None):
    return response(data=data)


def err404(
        msg: str = "资源不存在",
        code: int = 10404,
):
    return response(
        code=code,
        msg=msg,
        status=False,
    )


def err401(
        msg: str = "没有权限",
        code: int = 10401,
):
    return response(
        code=code,
        msg=msg,
        status=False,
    )


def err405(
        msg: str = "数据已存在",
        code: int = 10405,
):
    return response(
        code=code,
        msg=msg,
        status=False,
    )


def err500(
        msg: str = "服务端错误",
        code: int = 10500,
):
    return response(
        code=code,
        msg=msg,
        status=False,
    )
